package com.leetcode.algorithm.y22.m06;

/**
 * 1822. 数组元素积的符号
 * 
 * https://leetcode.cn/problems/sign-of-the-product-of-an-array/
 * 
 * @author jie.deng
 *
 */
class Question1822Solution01 {

	public int arraySign(int[] nums) {
		int mul = 1;
		for (int i = 0; i < nums.length; i++) {
			if (nums[i] == 0) {
				return 0;
			} else if (nums[i] > 0) {
				mul *= 1;
			} else {
				mul *= -1;
			}
		}
		return mul;
	}

}